import { defineEventHandler, readBody } from 'h3';

export default defineEventHandler(async (event) => {
  const body = await readBody(event);
  const { input, context: _context } = body;

  // 模拟行为执行
  const result = {
    status: 'completed' as const,
    output: {
      reservationId: `res_${Date.now()}`,
      status: 'confirmed',
      roomNumber: '101',
      checkInDate: input.checkInDate,
      checkOutDate: input.checkOutDate,
    },
    eventIds: [`evt_${Date.now()}`],
    state: 'reserved',
  };

  return {
    code: 0,
    data: result,
    message: '行为执行成功',
  };
});
